package ualrcdg.shared.dto;

import ualrcdg.shared.exceptions.CDGException;

/**
 * Simple implementation of the "taskFSM" object. See CDG XML Specifications: Game Descriptor Files.
 */
public class TaskFSM extends FSM_TransitionMatrix< String[] > implements AbstractRule
{
	final private String id;
	final private String name;
	
	/**
	 * Primary constructor
	 *
	 * @param id the id of the TaskFSM object to be created
	 * @param name the name of the TaskFSM object to be created
	 * @param stateCount the stateCount of the FSM_TransitionMatrix object to be created
	 * @param initialState the initialState of the FSM_TransitionMatrix object to be created
	 * @param acceptingStates the acceptingStates of the FSM_TransitionMatrix object to be created
	 * @param transitionMatrix the transitionMatrix of the FSM_TransitionMatrix object to be created
	 * @throws CDGException If the transition matrix description of the FSM is invalid
	 */
	public TaskFSM( String id, String name, int stateCount, int initialState, int[] acceptingStates, String[][][] transitionMatrix) throws CDGException
	{
		super( stateCount, initialState, acceptingStates, transitionMatrix );
		this.id = id;
		this.name = name;
		
		System.out.println( "Parsed: " + this.toString( ) );
	}

	/*
	 * @see ualrcdg.shared.dto.FSM_TransitionMatrix#toString()
	 */
	@Override
	public String toString( )
	{
		return "TaskFSM [<" + super.toString( ) + "> id=" + id + ", name=" + name + "]";
	}

	/**
	 * @return the name of this TaskFSM instance
	 */
	public String getName( )
	{
		return name;
	}

	/**
	 * @return the id of this TaskFSM instance
	 */
	@Override
	public String getId( )
	{
		return id;
	}
}
